#ifndef ASTARALGORITHM_H
#define ASTARALGORITHM_H

#include "searchalgorithm.h"
#include <queue>

enum class HeuristicType {
    MANHATTAN_DISTANCE,
    MISPLACED_TILES
};

class AStarAlgorithm : public SearchAlgorithm
{
public:
    AStarAlgorithm(HeuristicType heuristicType = HeuristicType::MANHATTAN_DISTANCE);
    
    // 重写基类方法
    SearchResult search(const PuzzleState& initial, const PuzzleState& goal) override;

    
    // 设置启发式函数类型
    void setHeuristicType(HeuristicType type) { heuristicType = type; }
    HeuristicType getHeuristicType() const { return heuristicType; }

private:
    HeuristicType heuristicType;

    
    // 辅助方法
    int calculateHeuristic(const PuzzleState& state, const PuzzleState& goal);
    std::string getHeuristicName() const;
};

#endif // ASTARALGORITHM_H